package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-07-25
 * Time: 13:25
 */
class Student {
    public String name;
    public int age;
    public String StuNum;

    public Student() {
        this("李四",18,"9877");
        System.out.println("不带参数的构造方法。。。。");
    }

    public Student(String name, int age, String stuNum) {
        this.name = name;
        this.age = age;
        StuNum = stuNum;
        System.out.println("调用了带有三个参数的构造方法");
    }

    public void eat() {
        System.out.println(this.name+" 在吃饭。。");
    }

    public void Doclass() {
        System.out.println(this.name+" 在上课.....");
    }
}
public class Test1 {
    public static void main(String[] args) {
        Student student = new Student("张三",10,"1234");
        student.eat();
        student.Doclass();

        Student student2 = new Student();
        student2.eat();
        student2.Doclass();
    }
}
